package com.teacher.pc.controller;


import com.teacher.common.CommonResult;
import com.teacher.pojo.dto.culturaltransmissiontask.CulturalTransmissionTaskAddDto;
import com.teacher.pojo.dto.culturaltransmissiontask.CulturalTransmissionTaskUpdateDto;
import com.teacher.pojo.vo.culturaltransmissiontask.CulturalTransmissionTaskGetVo;
import com.teacher.service.ICulturalTransmissionTaskService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 文化传播 前端控制器
 * </p>
 *
 * @author zfm
 * @since 2021-08-18
 */
@RestController
@RequestMapping("/pc/cultural-transmission-task")
public class CulturalTransmissionTaskController {

    @Autowired
    private ICulturalTransmissionTaskService iCulturalTransmissionTaskService;

    /**
     * 发起文化传播审批流程
     *
     * @param dto
     * @return
     */
    @PostMapping
    @ApiOperation("发起文化传播审批流程")
    public CommonResult<String> add(@RequestBody CulturalTransmissionTaskAddDto dto) {
        return iCulturalTransmissionTaskService.add(dto);
    }

    /**
     * 更新流程
     *
     * @param dto
     * @return
     */
    @PutMapping
    @ApiOperation("更新流程")
    public CommonResult<String> update(@RequestBody CulturalTransmissionTaskUpdateDto dto) {
        return iCulturalTransmissionTaskService.updateInfo(dto);
    }

    /**
     * 获取详情
     *
     * @return
     */
    @GetMapping("/{flowId}")
    @ApiOperation("获取详情")
    public CommonResult<CulturalTransmissionTaskGetVo> getDetails(@PathVariable("flowId") Long id) {
        return iCulturalTransmissionTaskService.getDetails(id);
    }

}

